//
// Created by Arikes on 9/27/21.
//

#ifndef DESIGNERMODE_CONCRETEMEDIATOR_H
#define DESIGNERMODE_CONCRETEMEDIATOR_H
#include "Mediator.h"
#include "Colleague.h"
#include "ConcreteColleague1.h"
#include <vector>
namespace MediatorMode
{
    class ConcreteMediator:public Mediator
    {
    public:
        virtual void regist(Colleague* cl)
        {
            _clArr.push_back(cl);
            std::cout<<"clArr :"<<_clArr.size()<<std::endl;
            cl->setMediator(this);
        }

        virtual void relay(Colleague* cl)
        {
            for (size_t i = 0; i < _clArr.size(); i++)
            {
                Colleague* item = _clArr.at(i);
                item->receive();
            }
            
        }        
    private:
        std::vector<Colleague*> _clArr;
    };
}

#endif //DESIGNERMODE_CONCRETEMEDIATOR_H